<?php
    include('../init.php');
    $m_levelx = 0;
    if(isset($_SESSION['m_level'])){
        if($_SESSION['m_level']==1){
            $m_levelx = 1;
        }else{
            $m_levelx = 3;
        }
    }
    
    $cid = $_REQUEST['cid'];
    $class = ' class="current"';
    $rss2 = $db->query('SELECT * FROM hs_product WHERE user_allow<='.$m_levelx.' AND pc_id='.$cid.' AND p_active=1 ORDER BY p_id DESC');
    $y = 0;
    $data['product'] = 0;
    $data['collectGroupList'] = '<ul>';
    while ($line2 = $db->fetchNextObject($rss2)){
        if(($y++)==0){
            $data['fImg'] = 'images/products/product/'.$line2->p_id.'/'.$line2->p_img;
            $data['fTitle'] = $line2->p_name;
            $data['fDetail'] = $line2->p_detail;
            $data['fId'] = $line2->p_id;
        }
        
        $data['collectGroupList'] .= ("<li id='".$line2->p_id."'><a href='javascript:void(0)' title='".$line2->p_name."'><img src='images/products/product/".$line2->p_id."/".$line2->p_img."' alt='".$line2->p_name."' /></a></li>");
        $data['product']++;
    }
    $data['collectGroupList'] .= '</ul>';
    
    echo json_encode($data);
?>